#ifndef THINGS_H
#define THINGS_H

#include "methods.h"

typedef struct
{
    char *description;
    char *name;
    method_list_t *methods;
    property_list_t *properties;
} thing_t;

#define thing_list_t general_list_t
#define thing_list_add general_list_add
#define thing_list_new general_list_new

thing_t *thing_create(char *name, char *description, method_list_t *methods, property_list_t *properties);

cJSON *thing_get_descriptor_json(thing_t *thing);
cJSON *thing_get_state_json(thing_t *thing);

cJSON *thing_list_get_descriptor_json(thing_list_t *list);
cJSON *thing_list_get_state_json(thing_list_t *list);

// 从Thinglist中获取指定名字的thing
thing_t *thing_list_get(thing_list_t *list, char *name);

// 调用thing执行command
void thing_invoke(thing_t *thing, cJSON *command);

// 调用thing_list执行command列表
void thing_list_invoke(thing_list_t *list, cJSON *command_array);

#endif